<template>
  <div class="container-big">
    <div style="padding-bottom: 436px;" class="container">
      <div style="margin-top:26px" class="from-box">
        <div style="padding: 0px 16px;" class="from ">
          <div class="from-item">
            <div style=" border-bottom: 1px solid rgba(151, 151, 151, 0.2);" class="from-input-box">
              <div class="from-input-tit cenLeft ">
                <span :style="[{color:$store.state.themeColor}]" class="from-input-tit-check ">
                  *
                </span>
                公司名称
              </div>
              <input style=" text-align: left;" maxlength="100" v-model.trim="from.company" placeholder="请输入" type="text" class="from-input">
            </div>
          </div>
          <div class="from-item">
            <div style=" border-bottom: 1px solid rgba(151, 151, 151, 0.2);" class="from-input-box">
              <div class="from-input-tit cenLeft ">
                <span :style="[{color:$store.state.themeColor}]" class="from-input-tit-check ">
                  *
                </span>
                行业
              </div>
              <input style=" text-align: left;" maxlength="100" v-model.trim="from.industry" placeholder="请输入" type="text" class="from-input">
            </div>
          </div>
          <div class="from-item">
            <div style=" border-bottom: 1px solid rgba(151, 151, 151, 0.2);" class="from-input-box">
              <div class="from-input-tit cenLeft ">
                <span :style="[{color:$store.state.themeColor}]" class="from-input-tit-check ">
                  *
                </span>
                规模
              </div>
              <input style=" text-align: left;" maxlength="100" v-model.trim="from.scale" placeholder="请输入" type="text" class="from-input">
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="screen-fixed-box cenCen ">
      <div style="background: #313339;width: 100%;" class="goods-box cenBet">
        <co-button @click="subFrom()" block color="primary">
          保存
        </co-button>
      </div>
    </div>
  </div>
</template>
<script>
import service from "@/api/profile";
export default {
  data() {
    return {
      from: {
        company: "",
        industry: "",
        scale: ""
      }
    };
  },
  created() {
    service.queryUserCompanyInfo().then(res => {
      const result = res.result;
      this.from.company = result.company;
      this.from.industry = result.industry;
      this.from.scale = result.scale;
    });
  },
  methods: {
    async subFrom() {
      if (!this.from.company) {
        this.$toast("请输入公司名称");
        return;
      }
      if (!this.from.industry) {
        this.$toast("请输入行业");
        return;
      }
      if (!this.from.scale) {
        this.$toast("请输入规模");
        return;
      }
      this.$store.state.loading = true;
      service
        .addEditUserCompanyInfo({
          ...this.from
        })
        .then(res => {
          this.$store.state.loading = false;
          if (res.success) {
            this.$toast("保存成功");
          }
        })
        .catch(() => {
          this.$store.state.loading = false;
        });
    }
  }
};
</script>

<style scoped>
.goods-box {
  z-index: 9;
  width: 100%;
  height: auto;
  padding: 0px;
  min-height: 110px;
  background: #35383f;
  box-shadow: 0 -10px 17px 0 rgba(0, 0, 0, 0.1);
}
.from-box {
  width: 100%;
  height: auto;
  padding: 0px 5%;
  margin-top: 16px;
  z-index: 2;
}
.from {
  width: 100%;
  height: auto;
  min-height: 160px;
  background: rgba(0, 0, 0, 0.4);
  /* border: 1px solid rgba(93, 93, 93, 0.2); */
  /* border: 1px solid #38383b; */
  padding: 0px 0px;
  margin-top: 16px;
  /* position: absolute;
  left: 5%;
  top: 328px; */
}
.from-item {
  width: 100%;
  height: auto;
}
.from > div:last-of-type > div {
  border-bottom: none;
}
.from-input-box {
  width: 100%;
  height: auto;
  min-height: 100px;
  position: relative;
  border-bottom: 1px solid rgba(151, 151, 151, 0.2);
  padding: 6px 1px;
}
.from-input-tit {
  width: auto;
  max-width: 146px;
  height: auto;
  min-height: 100px;
  /* font-family: PingFangSC-Regular; */
  font-size: 28px;
  color: #ffffff;
  text-align: left;
  padding: 1px 6px 0px 0px;
  position: relative;
}
.from-input-tit-check {
  margin-right: 1px;
}
.checkNot {
  opacity: 0;
}
.from-input {
  position: absolute;
  left: 0px;
  top: 0px;
  width: 100%;
  height: 100%;
  padding-left: 156px;
  padding-right: 46px;
  /* font-family: PingFangSC-Regular; */
  font-size: 28px;
  color: #fff;
  text-align: left;
}
</style>
